package com.ocom.mqsubsidy.controller;

import com.alibaba.fastjson.JSON;
import com.ocom.common.constant.MqPay;
import com.ocom.common.request.payconfig.SubsidyDataRequest;
import com.ocom.common.resp.Result;
import com.ocom.common.utils.ResultUtil;
import com.ocom.mqsubsidy.business.subsidydata.SubsidyDataProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class SubsidyDataController {

    @Autowired
    private SubsidyDataProductService subsidyDataProductService;

    @PostMapping(MqPay.URL_subsidyData)
    public Result subsidyData(@RequestBody SubsidyDataRequest subsidyDataRequest){
        String msg = JSON.toJSONString(subsidyDataRequest);
        subsidyDataProductService.handle(msg);
        return ResultUtil.success();
    }
}
